-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always use ctx.Locale.Tr
inside templates
#27231
Always use ctx.Locale.Tr
inside templates
#27231
Conversation
|
Done |
Refactoring performed using ```bash cd templates/ ag --only-matching --nofilename '[^{()\s]+\.Tr\b' | sed 's/ //g' | uniq --unique | sort -h | uniq --unique # Then pipe into vim, execute ':sort u', throw out `ctx.Locale.Tr`, and save as '../bad-instances' for bad_instance in $(cat ../bad-instances); do echo $bad_instance; for file in $(ag --literal --files-with-matches "$bad_instance") ; do vim "$file" -c ":%s/\(\<\)\?$bad_instance\(\>\)\?/\1ctx.Locale.Tr\2" -c ':wq' ; done; done # Edge cases that are not covered by above for file in $(ag --files-with-matches -Q '$ctx.Locale.Tr') ; do vim $file -c ':%s/\$ctx\.Locale\.Tr/ctx\.Locale\.Tr/g' -c ':wq'; done git checkout da0467e -- ./status/500.tmpl for file in $(ag --files-with-matches -Q '$.rootctx.Locale.Tr') ; do vim $file -c ':%sno/$.rootctx.Locale.Tr/ctx.Locale.Tr/g' -c ':wq'; done for file in $(ag --files-with-matches -Q '.rootctx.Locale.Tr') ; do vim $file -c ':%sno/.rootctx.Locale.Tr/ctx.Locale.Tr/g' -c ':wq'; done for file in $(ag --files-with-matches -Q '.ctxDatactx.Locale.Tr') ; do vim $file -c ':%sno/.ctxDatactx.Locale.Tr/ctx.Locale.Tr/g' -c ':wq'; done ```
14c6b07
to
321fd35
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't go through all files, but it looks good to me in general. I think we should merge, and fix possible issues when they appear. Thanks @delvh
Hmm… Is the current CI failure related to my changes or not? |
Looks related to me.... the few tests I looked at refer to some text inside pages, or http errors... looks like broken templates |
Found the culprit. |
Okay, now I am confused: |
@delvh It's the mail template under |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm after ci passes
I was unable to create a backport for 1.21. @delvh, please send one manually. 🍵
|
-> Backport ctx locale refactoring manually #27260 |
* giteaofficial/main: [skip ci] Updated translations via Crowdin Another round of `db.DefaultContext` refactor (go-gitea#27103) Fix more "locale" usages (go-gitea#27259) Always use `ctx.Locale.Tr` inside templates (go-gitea#27231) Disable `Test Delivery` and `Replay` webhook buttons when webhook is inactive (go-gitea#27211) # Conflicts: # templates/base/footer_content.tmpl # templates/repo/issue/view_content/context_menu.tmpl
* giteaoffical/main: (22 commits) Fix review UI (go-gitea#27322) Improve issue history dialog and make poster can delete their own history (go-gitea#27323) Improve branch list UI (go-gitea#27319) doctor: delete action entries without existing user (go-gitea#27292) fix orphan check for deleted branch (go-gitea#27310) make writing main test easier (go-gitea#27270) [skip ci] Updated translations via Crowdin Fix protected branch icon location (go-gitea#26576) move the `gitea admin` subcommands into separate files (go-gitea#27307) Fix chinese translation (go-gitea#27296) bump bleve (go-gitea#27300) Redefine the meaning of column is_active to make Actions Registration Token generation easier (go-gitea#27143) Use vitest globals (go-gitea#27102) Fix divider in subscription page (go-gitea#27298) Fix yaml test (go-gitea#27297) Enable production source maps for index.js, fix CSS sourcemaps (go-gitea#27291) Fix some animation bugs (go-gitea#27287) Add missed return to actions view fetch (go-gitea#27289) Fix more yaml lint errors (go-gitea#27284) Fix incorrect change from go-gitea#27231 (go-gitea#27275) ...
Refactoring performed using
This PR is a corollary to #27227 as that PR removes the unneeded
locale
parameters from subtemplates.